package pers.huangyuhui.sms.service.impl;

import org.apache.ibatis.session.SqlSession;
import org.springframework.stereotype.Service;
import pers.huangyuhui.sms.mapper.StudentMapper;
import pers.huangyuhui.sms.model.StudentInfo;
import pers.huangyuhui.sms.service.StudentService;
import pers.huangyuhui.sms.util.MyBatisUtil;

import java.util.List;
import java.util.Map;

@Service(value = "studentService")
public class StudentServiceImpl implements StudentService {

    private SqlSession sqlSession = MyBatisUtil.getSqlSession();

    private StudentMapper studentMapper = sqlSession.getMapper(StudentMapper.class);

    @Override
    public StudentInfo getUserInfo(String name, String password) {
        return studentMapper.getUserInfo(name, password);
    }

    @Override
    public boolean addStudent(StudentInfo studentInfo) {
        return studentMapper.addStudent(studentInfo);
    }

    @Override
    public List<StudentInfo> getStudentList(Map<String, Object> map) {
        return studentMapper.getStudentList(map);
    }

    @Override
    public int getStudentListNum(StudentInfo studentInfo) {
        return studentMapper.getStudentListNum(studentInfo);
    }

    @Override
    public boolean editStudentInfo(StudentInfo studentInfo) {
        return studentMapper.editStudentInfo(studentInfo);
    }

    @Override
    public boolean deleteStudent(String[] ids) {
        return studentMapper.deleteStudent(ids);
    }

    @Override
    public boolean modifyPassword(Map<String, Object> map) {
        return studentMapper.modifyPassword(map);
    }
}
